#include <boost/tokenizer.hpp>
#include <string>
#include <iostream>

int main()
{
	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;

	std::string s = "Boost C++ libraries";
	tokenizer tok(s); //* by default, boost::char_separator interprets spaces and punctuation marks as separators.
	for (tokenizer::iterator it = tok.begin(); it != tok.end(); ++it)
		std::cout << *it << std::endl;

	boost::char_separator<char> sep1(" "); //* separate only by space
	tokenizer tok1(s,sep1); 
	for (tokenizer::iterator it = tok1.begin(); it != tok1.end(); ++it)
		std::cout << *it << std::endl;

	boost::char_separator<char> sep2(" ","+"); //* separate only by space and +
	tokenizer tok2(s,sep2);
	for (tokenizer::iterator it = tok2.begin(); it!=tok2.end(); ++it)
		std::cout << *it << std::endl;

	boost::char_separator<char> sep3(" ","+", boost::keep_empty_tokens); //* see null string as token
	tokenizer tok3(s,sep3);
	for (tokenizer::iterator it = tok3.begin(); it!=tok3.end(); ++it)
		std::cout << *it << std::endl;
}